package cn.iocoder.yudao.module.trade.api.brokerage;

import cn.hutool.core.bean.BeanUtil;
import cn.iocoder.yudao.module.trade.api.brokerage.dto.BrokerageWithdrawRespDTO;
import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageWithdrawDO;
import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageWithdrawService;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

import javax.annotation.Resource;

@Service
@Validated
public class BrokerageWithdrawApiImpl implements BrokerageWithdrawApi {
    @Resource
    private BrokerageWithdrawService brokerageWithdrawService;

    @Override
    public BrokerageWithdrawRespDTO getBrokerageWithdrawById(String merchantTransferId) {
        BrokerageWithdrawDO brokerageWithdraw = brokerageWithdrawService.getBrokerageWithdraw(Long.parseLong(merchantTransferId));
        return BeanUtil.copyProperties(brokerageWithdraw, BrokerageWithdrawRespDTO.class);
    }

    @Override
    public void updateBrokerageWithdrawRemark(String merchantTransferId, String channelErrorMsg) {
        brokerageWithdrawService.updateBrokerageWithdrawRemark(merchantTransferId, channelErrorMsg);
    }
}
